﻿Public Class frmLog

    Private Sub FormLogListado_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dgLOG.AutoGenerateColumns = False
        fechaInicio.Value = DateTime.Now.AddDays(-5)

        CargarLogs()

        txtDescripcion.Focus()

        Me.WindowState = FormWindowState.Maximized

    End Sub

    Dim classController As New ControllerSigeco.controller_sistema

    Private Sub CargarLogs()

        Dim dt As New DataTable
        dt = classController.get_Log_All(oiml.dbConn, txtDescripcion.Text, txtUsuario.Text, fechaInicio.Value, fechaFin.Value, txtDatoAnterior.Text, txtDatoActualizado.Text)

        dgLOG.DataSource = dt

        txtDescripcion.Focus()

        If Not classController.MessageError Is Nothing Then
            MessageBox.Show("Error: " & classController.MessageError.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If

    End Sub

    Private Sub btnCancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancelar.Click

        Me.Close()

    End Sub

    Private Sub txtBuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBuscar.Click
        CargarLogs()
    End Sub

    Private Sub txtDescripcion_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtDescripcion.KeyDown
        If e.KeyCode = Keys.Enter Then
            CargarLogs()

        End If
    End Sub

    Private Sub fechaInicio_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles fechaInicio.KeyDown
        If e.KeyCode = Keys.Enter Then
            CargarLogs()

        End If
    End Sub

    Private Sub fechaFin_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles fechaFin.KeyDown
        If e.KeyCode = Keys.Enter Then
            CargarLogs()

        End If
    End Sub

    Private Sub txtUsuario_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtUsuario.KeyDown
        If e.KeyCode = Keys.Enter Then
            CargarLogs()

        End If
    End Sub

    Private Sub txtDatoAnterior_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtDatoAnterior.KeyDown
        If e.KeyCode = Keys.Enter Then
            CargarLogs()

        End If
    End Sub

    Private Sub txtDatoActualizado_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtDatoActualizado.KeyDown
        If e.KeyCode = Keys.Enter Then
            CargarLogs()

        End If
    End Sub
End Class